home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 January - Disc 2 / Macworld (1999-01) (Disk 2).dmg / Serious Demos / Symbolic Composer 4.2 / Environment / Projects / Questions & Answers / Q&A Programming Music / Zones with fit-to-sheet < prev   
Encoding:
Text File  |  1998-10-26  |  2.5 KB  |  60 lines  |  [TEXT/ScoM]

  1. SPREADING ZONES WITH FIT-TO-SHEET
  2.  
  3. >                 Pan  (list (gen-cresc-dim 1 127 32))  ; restarted each 
  4. >zone
  5.  
  6. You can use distribute to span material on several zones. You can also
  7. use fit-to-sheet, which fits a vector onto all zones of a section, and
  8. this case the (sheetlen) returns the number of elements needed. It
  9. calculates how many length units are needed to equal the sum of all
  10. zones of a section. Fit-to-sheet then cuts the vector values
  11. into equal sizes sublists.
  12.  
  13.     crystalcnt
  14.      channel 9
  15.      symbol '(=)
  16.      velocity '(0)
  17.      length '(1/16-3) 
  18.      controller (mu80-controllers
  19.                   attact-time (fit-to-sheet (vector-round 72 87 (gen-sin 10 1 (sheetlen) 90)))
  20.                   filter (fit-to-sheet (vector-round 57 80 (gen-sin 9 1 (sheetlen) 90)))
  21.                   volume (fit-to-sheet (vector-round 50 60 (gen-sin 3 1 (sheetlen)))))
  22.  
  23. These functions are defined here. It shows you how to calculate spreadings 
  24. like this. Fit-to-sheet calls symbol-divide to cut the material into pieces.
  25.  
  26. (defun fit-to-sheet (v)
  27.   (let* ((zones (get-value-or-default 'zone *current-instrument* *current-section*))
  28.          (zone-unit (abs (get-tick (car zones))))
  29.          (length-unit (get-tick 
  30.                        (car (get-value-or-default 'length 
  31.                                                   *current-instrument* 
  32.                                                   *current-section*))))
  33.          (values-per-zone (truncate (/ zone-unit length-unit))))
  34.     (symbol-divide values-per-zone nil nil (vector-to-list v))))
  35.     
  36. (defun sheetlen ()
  37.   (roundup
  38.    (/ (make-zone (get-value-or-default 'zone *current-instrument* *current-section*))
  39.       (get-tick (car (get-value-or-default 'length *current-instrument* *current-section*))))))
  40.  
  41.  
  42. >; Peter: Why I can not define a controller list to go across zones as the 
  43. >following lines? 
  44. >; (I can do it with symbols and lengths...see velocity...)
  45. >;                Pan   '(64 34 56 12)
  46. >;                Pan  (gen-cresc-dim 1 127 30)
  47. >                 
  48. >                 
  49. >                 )
  50. >     groove   '(0)
  51. >     tuning '((0))
  52. >  )
  53.  
  54. There is a historical reason. During its first 5 years Symbolic Composer
  55. could not at all process controllers. The way they were implemented
  56. reflected the way it was possible to patch them into the compiler. Then
  57. it took a couple of more years to evolve the concept of distribution.
  58. So at the time controllers were implemented it was impossible to
  59. realize lists that go across zones that way. 
  60.